'\" te
.\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACCT.H 3HEAD "May 19, 1994"
.SH NAME
acct.h, acct \- per-process accounting file format
.SH SYNOPSIS
.LP
.nf
#include <sys/types.h>
#include <sys/acct.h>
.fi

.SH DESCRIPTION
.sp
.LP
Files produced as a result of calling \fBacct\fR(2) have records in the form
defined by <\fBsys/acct.h\fR>, whose contents are:
.sp
.in +2
.nf
typedef ushort_t  comp_t;   /* pseudo "floating point"
                               representation */
                            /* 3 bit base-8 exponent in the high */
                            /* order bits, and a 13-bit fraction */
                            /* in the low order bits. */

struct	acct
{
    char   ac_flag;    /* Accounting flag */
    char   ac_stat;    /* Exit status */
    uid_t  ac_uid;     /* Accounting user ID */
    gid_t  ac_gid;     /* Accounting group ID */
    dev_t  ac_tty;     /* control tty */
    time_t ac_btime;   /* Beginning time */
    comp_t ac_utime;   /* accounting user time in clock ticks */
    comp_t ac_stime;   /* accounting system time in clock ticks */
    comp_t ac_etime;   /* accounting total elapsed time in clock
                          ticks */
    comp_t ac_mem;     /* memory usage in clicks (pages) */
    comp_t ac_io;      /* chars transferred by read/write */
    comp_t ac_rw;      /* number of block reads/writes */
    char   ac_comm[8]; /* command name */
};

/*
 * Accounting Flags
 */

#define AFORK   01    /* has executed fork, but no exec */
#define ASU     02    /* used super-user privileges */
#define ACCTF   0300  /* record type */
#define AEXPND  040   /* Expanded Record Type \(mi default */
.fi
.in -2

.sp
.LP
In \fBac_flag\fR, the \fBAFORK\fR flag is turned on by each \fBfork\fR and
turned off by an \fBexec\fR. The \fBac_comm\fR field is inherited from the
parent process and is reset by any \fBexec\fR. Each time the system charges the
process with a clock tick, it also adds to \fBac_mem\fR the current process
size, computed as follows:
.sp
.LP
\fI(data size) + (text size) / (number of in-core processes using text)\fR
.sp
.LP
The value of \fBac_mem\|/\|(ac_stime\|+\|ac_utime)\fR can be viewed as an
approximation to the mean process size, as modified by text sharing.
.sp
.LP
The structure \fBtacct\fR, (which resides with the source files of the
accounting commands), represents a summary of accounting statistics for the
user id \fBta_uid\fR. This structure is used by the accounting commands to
report  statistics based on user id.
.sp
.in +2
.nf
/*
 *  total accounting (for acct period), also for day
 */
struct tacct {
   uid_t           ta_uid;       /* user id */
   char            ta_name[8];   /* login name */
   float           ta_cpu[2];    /* cum. cpu time in minutes, */
                                 /* p/np (prime/non-prime time) */
   float           ta_kcore[2];  /* cum. kcore-minutes, p/np */
   float           ta_con[2];    /* cum. connect time in minutes,
                                     p/np */
   float           ta_du;        /* cum. disk usage (blocks)*/
   long            ta_pc;        /* count of processes */
   unsigned short  ta_sc;        /* count of login sessions */
   unsigned short  ta_dc;        /* count of disk samples */
   unsigned short  ta_fee;       /* fee for special services */
};
.fi
.in -2

.sp
.LP
The \fBta_cpu\fR, \fBta_kcore\fR, and \fBta_con\fR members contain usage
information pertaining to prime time and non-prime time hours.  The first
element in each array represents the time the  resource was used during prime
time hours.  The second element in  each array represents the time the resource
was used during non-prime time hours.  Prime time and non-prime time hours may
be set in the  \fBholidays\fR file (see \fBholidays\fR(5)).
.sp
.LP
The \fBta_kcore\fR member is a cumulative measure of the amount of memory used
over the accounting period by processes owned by the user with uid
\fBta_uid\fR. The amount shown represents kilobyte segments of memory used, per
minute.
.sp
.LP
The \fBta_con\fR member represents the amount of time the user was logged in to
the system.
.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/acct/holidays\fR\fR
.ad
.RS 22n
prime/non-prime time table
.RE

.SH SEE ALSO
.sp
.LP
.BR acctcom (1),
.BR acct (2),
.BR exec (2),
.BR fork (2),
.BR acct (8),
.BR acctcon (8),
.BR acctmerg (8),
.BR acctprc (8),
.BR acctsh (8),
.BR prtacct (8),
.BR runacct (8),
.BR shutacct (8)
.SH NOTES
.sp
.LP
The \fBac_mem\fR value for a short-lived command gives little information about
the actual size of the command, because \fBac_mem\fR may be incremented while a
different command (for example, the shell) is being executed by the process.
